package anji.plus.system.mark.controller;


import anji.plus.system.mark.base.BaseController;
import anji.plus.system.mark.base.IBaseService;
import anji.plus.system.mark.domain.AccountRecord;
import anji.plus.system.mark.response.ResponseResult;
import anji.plus.system.mark.service.IAccountRecordService;
import anji.plus.system.mark.vo.TotalRecords;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 * 系统用户表 前端控制器
 * </p>
 *
 * @author luwei
 * @since 2023-11-08
 */
@RestController
@RequestMapping("sys/accountRecord")
public class AccountRecordController extends BaseController {


    @Resource
    private IAccountRecordService accountRecordService;

    @Override
    public IBaseService getService() {
        return null;
    }

    /**
     * 新增记录
     *
     * @return
     * @throws
     * @author zhouchong
     * @date 2023/12/08 15:40
     */
    @PostMapping({"addRecord"})
    public ResponseResult addRecord(@RequestBody AccountRecord accountRecord) {
        accountRecordService.addRecord(accountRecord);
        return ResponseResult.success("新增成功");
    }

    /**
     * 查询全部记录
     *
     * @return
     * @throws
     * @author zhouchong
     * @date 2023/12/08 15:40
     */
    @GetMapping({"queryRecord"})
    public List<AccountRecord> queryAccountRecordList(String recordType) {
        return accountRecordService.queryAccountRecordList(recordType);
    }

    /**
     * 查询全部记录-按日期封装
     *
     * @return
     * @throws
     * @author zhouchong
     * @date 2023/12/11 15:40
     */
    @GetMapping({"queryRecordList"})
    public ResponseResult queryTotalRecords(String recordType) {
        return ResponseResult.success(accountRecordService.queryTotalRecords(recordType));
    }






}


